<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>文章列表</title>
    <link rel="stylesheet" href="./libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/iconfont.css">
    <link rel="stylesheet" href="./css/main.css">
    <script src="./libs/jquery-1.12.4.min.js"></script>
    <!-- 引入模板引擎js文件 -->
    <script src="./libs/template-web.js"></script>

    <script src="./libs/bootstrap/js/bootstrap-paginator.js"></script>
    <script src="./libs/bootstrap/js/bootstrap.min.js"></script>
    <script src="./js/http.js"></script>
    <script src="./js/article_list.js"></script>
</head>

<body>
    <div class="container-fluid">
        <div class="common_title">
            文章列表
        </div>
        <div class="container-fluid common_con">
            <div class="row opt_btns">
                <div class="col-xs-6">
                    <form class="form-inline">
                        <select id="selCategory" name="" class="form-control input-sm">
                            <!-- <option value="">所有分类</option>
                            <option>未分类</option>
                            <option>奇趣事</option>
                            <option>会生活</option>
                            <option>爱旅行</option> -->
                        </select>
                        <select id="selStatus" name="" class="form-control input-sm">
                            <option value="">所有状态</option>
                            <option value="草稿">草稿</option>
                            <option value="已发布">已发布</option>
                        </select>
                        <button id="btnSearch" class="btn btn-default btn-sm">筛选</button>
                    </form>
                </div>
                <div class="col-xs-6">
                    <a href="article_release.html" class="btn btn-success btn-sm pull-right" id="release_btn">发表文章</a>
                </div>
            </div>
            <table class="table table-striped table-bordered table-hover mp20">
                <thead>
                    <tr>
                        <th>标题</th>
                        <th>作者</th>
                        <th>分类</th>
                        <th class="text-center">发表时间</th>
                        <th class="text-center">状态</th>
                        <th class="text-center" width="100">操作</th>
                    </tr>
                </thead>
                <tbody>

                    <!-- 在这里使用art-template来渲染文章的信息 -->
                    <script id="article_list" type="text/html">
                        {{each data}}
                        <tr>
                            <td>{{$value.title}}</td>
                            <td>{{$value.author}}</td>
                            <td>{{$value.category}}</td>
                            <td class="text-center">{{$value.date}}</td>
                            <td class="text-center">{{$value.state}}</td>
                            <td class="text-center">
                                <!-- 通过 ?id= 的方式把文章id从文章列表页传到文章编辑页 -->
                                <a href="article_edit.html?id={{ $value.id }}" data-id="{{$value.id }}" class="btn btn-default btn-xs">编辑</a>
                                <a href="javascript:void(0);" data-id="{{$value.id }}" class="btn btn-danger btn-xs delete">删除</a>
                            </td>
                        </tr>
                        {{/each}}
                    </script>




                    <!-- <tr>
                        <td>王积千造统最头</td>
                        <td>杰克</td>
                        <td>奇趣事</td>
                        <td class="text-center">2017-06-08 07:08:46</td>
                        <td class="text-center">已发布</td>
                        <td class="text-center">
                            <a href="article_edit.html" class="btn btn-default btn-xs">编辑</a>
                            <a href="javascript:void(0);" class="btn btn-danger btn-xs delete">删除</a>
                        </td>
                    </tr> -->
                </tbody>
            </table>

        </div>

        <!-- 分页器容器,text-center类名添加之后分页器会居中 -->
        <div class="page text-center">
            <ul class="pagination">
            </ul>
        </div>
    </div>


    <!-- 下拉菜单模板 -->
    <script type="text/html" id="category_list">
    <option value="">所有分类</option>
    {{ each data}}
    <!-- value值是获取文章数据的时候传递过来的，用来在通过分类查询文章时根据id来查找文章 -->
    <option value="{{$value.id}}" >{{ $value.name }}</option>
    {{ /each }}
</script>
</body>

</html>